diff --git a/gcube/extra-resources/web.xml b/gcube/extra-resources/web.xml
index c015b16..8b98727 100644
--- a/gcube/extra-resources/web.xml
+++ b/gcube/extra-resources/web.xml
@@ -9,18 +9,11 @@
A gcube service - smartgears 4
-
-
- resolver-basepath
- https://data-d.d4science.org/shub
-
-
- IDM
- org.gcube.idm.IdentityManagerResourceInitializer
+ org.gcube.idm.IdentityManagerResourceInitializer
- IDM
- /identity-manager/*
+ org.gcube.idm.IdentityManagerResourceInitializer
+ /idm/*
-
\ No newline at end of file
+
diff --git a/pom.xml b/pom.xml
index 0b4f05e..e430727 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
maven-parent
1.2.0
- org.gcube.idm
+ org.gcube.idm
identity-manager
1.0.0-SNAPSHOT
war
@@ -43,47 +43,39 @@
+
-
- org.slf4j
- slf4j-api
-
-
- org.gcube.common
- common-security
-
-
- org.glassfish.jersey.media
- jersey-media-multipart
-
-
- org.glassfish.jersey.containers
- jersey-container-servlet
-
-
- javax.ws.rs
- javax.ws.rs-api
-
-
- org.gcube.core
- common-smartgears-app
-
+
org.gcube.core
common-smartgears
org.gcube.core
- common-scope
+ common-smartgears-app
+
+
+
+ javax.ws.rs
+ javax.ws.rs-api
- org.gcube.core
- common-scope-maps
+ org.glassfish.jersey.containers
+ jersey-container-servlet
-
- org.gcube.core
- common-encryption
+ javax.servlet
+ javax.servlet-api
+ 3.0.1
+
+
+
+ org.glassfish.jersey.media
+ jersey-media-json-jackson
+
+
+ org.slf4j
+ slf4j-api
diff --git a/src/main/java/org/gcube/idm/IdentityManagerExceptionMapper.java b/src/main/java/org/gcube/idm/IdentityManagerExceptionMapper.java
deleted file mode 100644
index fd68b3e..0000000
--- a/src/main/java/org/gcube/idm/IdentityManagerExceptionMapper.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.gcube.idm;
-
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-
-/**
- * @author Alfredo Oliviero (ISTI - CNR)
- */
-@Provider
-public class IdentityManagerExceptionMapper implements ExceptionMapper {
-
- @Override
- public Response toResponse(Exception exception) {
-
- Status status = Status.INTERNAL_SERVER_ERROR;
- String exceptionMessage = exception.getMessage();
- try {
- if(exception.getCause() != null) {
- exceptionMessage = exception.getCause().getMessage();
- }
- } catch(Exception e) {
- exceptionMessage = exception.getMessage();
- }
- MediaType mediaType = MediaType.TEXT_PLAIN_TYPE;
-
- if(WebApplicationException.class.isAssignableFrom(exception.getClass())) {
- Response gotResponse = ((WebApplicationException) exception).getResponse();
- status = Status.fromStatusCode(gotResponse.getStatusInfo().getStatusCode());
- }
-
- return Response.status(status).entity(exceptionMessage).type(mediaType).build();
- }
-
-}
diff --git a/src/main/java/org/gcube/idm/IdentityManagerResourceInitializer.java b/src/main/java/org/gcube/idm/IdentityManagerResourceInitializer.java
index df04bf3..e6c3186 100644
--- a/src/main/java/org/gcube/idm/IdentityManagerResourceInitializer.java
+++ b/src/main/java/org/gcube/idm/IdentityManagerResourceInitializer.java
@@ -1,7 +1,13 @@
package org.gcube.idm;
-import javax.ws.rs.ApplicationPath;
+import java.util.HashSet;
+import java.util.Set;
+import javax.ws.rs.ApplicationPath;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Application;
+
+import org.gcube.common.gxrest.response.entity.SerializableErrorEntityTextWriter;
import org.gcube.idm.rest.TestRest;
import org.gcube.smartgears.annotations.ManagedBy;
import org.glassfish.jersey.server.ResourceConfig;
@@ -10,17 +16,17 @@ import org.glassfish.jersey.server.ResourceConfig;
* @author Alfredo Oliviero (ISTI - CNR)
*/
-
- // SMARTGEARS
+// SMARTGEARS
// legge i parametri del service da application.yaml
-@ApplicationPath("/")
-@ManagedBy(IdentityManagerdInitializator.class)
-public class IdentityManagerResourceInitializer extends ResourceConfig {
-
- public IdentityManagerResourceInitializer() {
- packages(TestRest.class.getPackage().toString());
- //packages(UsersRest.class.getPackage().toString());
+@Path("idm")
+public class IdentityManagerResourceInitializer extends Application {
+
+ public Set> getClasses() {
+ final Set> classes = new HashSet>();
+ // register resources and features
+ classes.add(TestRest.class);
+ return classes;
}
-
+
}
diff --git a/src/main/java/org/gcube/idm/rest/TestRest.java b/src/main/java/org/gcube/idm/rest/TestRest.java
index 5b2873b..5195873 100644
--- a/src/main/java/org/gcube/idm/rest/TestRest.java
+++ b/src/main/java/org/gcube/idm/rest/TestRest.java
@@ -4,6 +4,11 @@ import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
+import org.gcube.common.security.providers.SecretManagerProvider;
+import org.gcube.common.security.secrets.Secret;
+import org.gcube.idm.IdentityManagerdInitializator;
+import org.gcube.smartgears.annotations.ManagedBy;
+
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import com.webcohesion.enunciate.metadata.rs.ResourceGroup;
@@ -15,6 +20,7 @@ import com.webcohesion.enunciate.metadata.rs.ResourceLabel;
@RequestHeaders({
@RequestHeader( name = "Authorization", description = "Bearer token, see https://dev.d4science.org/how-to-access-resources")
})
+@ManagedBy(IdentityManagerdInitializator.class)
public class TestRest {
@GET
@@ -24,4 +30,14 @@ public class TestRest {
return "{'aaa':bbb'}";
}
-}
\ No newline at end of file
+ @GET
+ @Path("show_context")
+ @Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
+ public String show_context(){
+ Secret smp = SecretManagerProvider.instance.get();
+ String ctx = smp.getContext();
+ return ctx;
+ }
+
+}
+